package com.ruoyi.kong.service.impl;

import com.ruoyi.kong.entity.KongEntity;
import com.ruoyi.kong.entity.KongSni;
import com.ruoyi.kong.fegin.KongClientService;
import com.ruoyi.kong.service.IKongSniService;
import com.ruoyi.kong.utils.KongActiveProfileUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class KongSniServiceImpl implements IKongSniService {

    @Autowired
    private KongActiveProfileUtil kongActiveProfileUtil;


    @Override
    public KongEntity<KongSni> snis() {
        return KongClientService.getInstance(kongActiveProfileUtil.getKongServerUrl()).snis();
    }

    public KongSni sniById(String id){
        return KongClientService.getInstance(kongActiveProfileUtil.getKongServerUrl()).sniById(id);
    }

    public KongSni addSni(KongSni kongSni){
        return KongClientService.getInstance(kongActiveProfileUtil.getKongServerUrl()).addSni(kongSni);
    }

    public KongSni updateSni(String id,KongSni sni){
        return KongClientService.getInstance(kongActiveProfileUtil.getKongServerUrl()).updateSni(id,sni);
    }

    public void deleteSni(String id){
        KongClientService.getInstance(kongActiveProfileUtil.getKongServerUrl()).deleteSni(id);
    }
}
